#============================================================
#	Icon
#============================================================
# @datetime: 2022-5-4 23:28:36
#============================================================
extends TextureRect


func get_drag_data(position):
	self.modulate.a = 0.5
	var margin = MarginContainer.new()
	var texture_rect = self.duplicate()
	texture_rect.modulate.a = 1
	texture_rect.rect_min_size = texture_rect.rect_size
	margin.set("custom_constants/margin_left", -rect_size.x * 0.5)
	margin.set("custom_constants/margin_top", -rect_size.y * 0.8)
	margin.add_child(texture_rect)
	set_drag_preview(margin)
	# 节点退出树，则代表放下了
	margin.connect("tree_exited", self, "_drop")
	return owner


func _drop():
	self.modulate.a = 1.0

